#ifndef _DDATAWRITABLE_H
#define _DDATAWRITABLE_H

//==============================================================================
//
//      DDataWritable - the data writable protocol in the ofc-library
//
//               Copyright (C) 2003  Dick van Oudheusden
//  
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free
// Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//==============================================================================
// 
//  $Date: 2003-09-09 16:34:06 $ $Revision: 1.1 $
//
//==============================================================================

#include "ofc/config.h"

// The DDataWritable protocol specifies the interface for writing binairy data 
// to a class implementing this interface.

@protocol DDataWritable

//
// Return the error
//
// @return the error code (or 0)
// 

- (int) error;

//
// Write a data string 
//
// @param data     the data to be written
// @param length   the length of the data
//
// @return success
//

- (BOOL) writeData :(const unsigned char *) data :(unsigned long) length;

//
// Write a character
//
// @param ch       the character to be written
//
// @return success
//

- (BOOL) writeChar :(char) ch;

//
// Write a byte
//
// @param byte     the byte to be written
//
// @return success
//

- (BOOL) writeByte :(unsigned char) byte;

//
// Write a short 
//
// @param sh       the short to be written
//
// @return success
//

- (BOOL) writeShort :(short) sh;

//
// Write a long
//
// @param sh       the long to be written
//
// @return success
//

- (BOOL) writeLong :(long) sh;

//
// Write a double
//
// @param sh       the double to be written
//
// @return success
//

- (BOOL) writeDouble :(double) sh;

//
// Tell the current position in the writeable
//
// @return the current position
//

- (unsigned long) tell;

//
// Move the current position to a location
//
// @param offset   the offset from the origin (in bytes)
// @param origin   the origin for the offset (0=begin, 1=current, 2=end)
//
// @return success
//

- (BOOL) seek :(unsigned long) offset :(int) origin;

//
// Skip a number of positions
//
// @param offset   the number of bytes to skip
//
// @return success
//

- (BOOL) skip :(unsigned long) offset;

@end

#endif

/*============================================================================*/
